<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 创建一个动画效果 */
        @keyframes myAnimation {
            0% {
                background-color: red;
                transform: rotate(0deg);
                /* margin-left: 0; */
            }

            50% {
                background-color: yellow;
                transform: rotate(180deg);
                /* margin-left: 400px; */
            }

            100% {
                background-color: green;
                transform: rotate(360deg);
                /* margin-left: 800px; */
            }
        }

        .box {
            width: 200px;
            height: 200px;
            background-color: black;
            /* 动画名称 */
            animation-name: myAnimation;
            /* 动画一轮持续时间 */
            animation-duration: 2s;
            animation-iteration-count: infinite;
            /* 动画执行速率 */
            animation-timing-function: linear;
        }
    </style>
</head>

<body>
    <div class="box"></div>
</body>

</html>